"""
【练习】字符统计
从键盘输入一个字符序列，统计，大写字母，小写字母，数字，其它字符各出现次数，将次数保存到字典中
"""

def count_str(s):
    dic = {'num': 0, 'upper': 0, 'lower': 0, 'other': 0}
    for i in s:
        if '0' <= i <= '9':
            dic['num'] += 1
        elif 'A' <= i <= 'Z':
            dic['upper'] += 1
        elif 'a' <= i <= 'z':
            dic['lower'] += 1
        else:
            dic['other'] += 1

    return dic







